<!DOCTYPE html>
<html lang="zh-cmn-Hans">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>实验室药品管理</title>
</head>
<body>
<h1>正在检测链接是否可用</h1>
<div id="status">检测中...</div>
<button onclick="checkStatus()">手动检查</button>

<script>
    const statusUrl = 'https://3bd3cbc4.r15.cpolar.top/api/data';
    const statusElement = document.getElementById('status');
    const targetUrl = 'https://3bd3cbc4.r15.cpolar.top'; // 目标跳转URL
    const url_gitee_download = 'https://gitee.com/dont-send-it-to-the-east/url_get/repository/archive/master.zip'
    
    function showError() {
        statusElement.innerHTML = '❌ 链接不可用';
        statusElement.style.color = 'red';
        window.location.href = url_gitee_download;
    }

    function checkStatus() {
        fetch(statusUrl)
            .then(response => {
                if (!response.ok) throw new Error('状态不正常');
                return response.json();
            })
            .then(data => {
                statusElement.innerHTML = `✅ 链接正常，即将跳转`;
                statusElement.style.color = 'green';
                // 使用location.href进行跳转
                setTimeout(() => {
                    window.location.href = targetUrl;
                }, 1000); // 1秒后跳转
            })
            .catch(error => {
                console.error('检测失败:', error);
                showError();
            });
    }

    // 初始检测和定期检测
    checkStatus();
    setInterval(checkStatus, 30000);
</script>
</body>
</html>